Skip to content

fix(packaging): make onefile fork diagnostics opt-in - #28

Merged
Designerspr merged 1 commit into
LilacMeteorObservatory:mainfrom
mordom0404:fix/onefile-fork-log-env-switch
Nov 25, 2026
Merged

Designerspr merged 1 commit into
LilacMeteorObservatory:mainfrom
mordom0404:fix/onefile-fork-log-env-switch

Conversation

@mordom0404

Copy link
Copy Markdown
Contributor

Problem

Every onefile launch writes the fork target to stderr:

[MetDetPy onefile] METDETPY_MSIX_ONEFILE_PATCH_ACTIVE fork target: logical="..." final="..."

Launchers that treat any child stderr as a warning (e.g. MeteorMasterAI) show a bogus warning on every run, even on a plain Win32 install where logical and final are identical and no MSIX redirection happens. The line is printed unconditionally today.

Change

  • The line is now opt-in: METDETPY_ONEFILE_VERBOSE=1 (any value starting with 1/y/t) prints it; everything else, including unset, keeps production and Store builds silent.
  • The marker string stays in the compiled bootstrap, so verify_msix_onefile_patch() and the UPX search path keep working unchanged.
  • patch_bootstrap() now also asserts that VERBOSE_ENV_VAR appears in CREATE_CODE, so the C literal and the Python constant cannot drift apart.
  • The README documents the switch; a regression test covers the opt-in guard.

Verification

  • python -m pytest tests/test_nuitka_patch.py → 22 passed.
  • Compiled the injected C exactly as generated (cl /W3 /TC, MSVC 2022 x64, Nuitka 4.0.5 anchors): no warnings, no errors.
  • Harness run: silent with no env var, prints the line with METDETPY_ONEFILE_VERBOSE=1, and METDETPY_MSIX_ONEFILE_PATCH_ACTIVE is still present in the binary.

Branched from main because the patch moved to MetLib/packaging/nuitka_patches/ in 871aba5, which is not in dev yet.

Every onefile launch printed the fork target to stderr. Launchers such as
MeteorMasterAI surface any child stderr as a warning, so users got a bogus
warning on every run even though the patch resolved the logical path to
itself (no MSIX redirection in a plain Win32 install).

Gate the line behind METDETPY_ONEFILE_VERBOSE instead of printing it
unconditionally: values starting with 1/y/t enable it, everything else
(including unset) keeps production and Store builds silent. The marker
string stays in the compiled bootstrap, so the post-build artifact check
and the loud-by-choice troubleshooting path both keep working.

Also verify in patch_bootstrap that the env var name still appears in
CREATE_CODE, document the switch, and add a regression test.
@Designerspr Designerspr self-assigned this Nov 25, 2026
@Designerspr
Designerspr merged commit a757ee4 into LilacMeteorObservatory:main Nov 25, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants